/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.dataModel;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Alexandre
 */
@Entity
@Table(name = "cob")
public class Cobranca implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "TREC_ID")
    private Long trecId;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "COB_DIST")
    private BigDecimal cobDist;
    @Basic(optional = false)
    @NotNull
    @Column(name = "COB_TAX")
    private BigDecimal cobTax;
    @JoinColumn(name = "TRAN_ID_DEBT", referencedColumnName = "TRAN_ID")
    @OneToOne(optional = false)
    private Transacao tranIdDebt;
    @JoinColumn(name = "TRAN_ID_CRED", referencedColumnName = "TRAN_ID")
    @OneToOne(optional = false)
    private Transacao tranIdCred;

    public Cobranca() {
    }

    public Cobranca(Long trecId) {
        this.trecId = trecId;
    }

    public Cobranca(Long trecId, BigDecimal cobDist, BigDecimal cobTax) {
        this.trecId = trecId;
        this.cobDist = cobDist;
        this.cobTax = cobTax;
    }

    public Long getTrecId() {
        return trecId;
    }

    public void setTrecId(Long trecId) {
        this.trecId = trecId;
    }

    public BigDecimal getCobDist() {
        return cobDist;
    }

    public void setCobDist(BigDecimal cobDist) {
        this.cobDist = cobDist;
    }

    public BigDecimal getCobTax() {
        return cobTax;
    }

    public void setCobTax(BigDecimal cobTax) {
        this.cobTax = cobTax;
    }

    public Transacao getTranIdDebt() {
        return tranIdDebt;
    }

    public void setTranIdDebt(Transacao tranIdDebt) {
        this.tranIdDebt = tranIdDebt;
    }

    public Transacao getTranIdCred() {
        return tranIdCred;
    }

    public void setTranIdCred(Transacao tranIdCred) {
        this.tranIdCred = tranIdCred;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (trecId != null ? trecId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cobranca)) {
            return false;
        }
        Cobranca other = (Cobranca) object;
        if ((this.trecId == null && other.trecId != null) || (this.trecId != null && !this.trecId.equals(other.trecId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.liquidByte.trafficMustang.server.dataModel.Cobranca[ trecId=" + trecId + " ]";
    }
    
}
